package com.codinghero.zqlb.weibo.sina.driver;

import weibo4j.Weibo;
import weibo4j.http.AccessToken;
import weibo4j.model.PostParameter;
import weibo4j.model.WeiboException;
import weibo4j.util.WeiboConfig;

public class OAuthExtend {
	public AccessToken getAccessTokenByPassword(String username, String password) throws WeiboException {
		return new AccessToken(Weibo.client.post(
				WeiboConfig.getValue("accessTokenURL"),
				new PostParameter[] {
						new PostParameter("client_id", WeiboConfig.getValue("client_ID")),
						new PostParameter("client_secret", WeiboConfig.getValue("client_SERCRET")),
						new PostParameter("grant_type", "password"),
						new PostParameter("username", username),
						new PostParameter("password", password) }
				, false));
	}
}
